#include "./util/launchUtil.h"
#include "launch.h"

static char* OBJECT_LIB_PATH = "../objects/";

int main(int argc, char** argv) {
	if(argc != 3){
		perror("launch usage : <OBJECT.so> <Shared Memory File>");
		exit(EXIT_FAILURE);
	}
	void* opaque_handle = NULL;
	char lib_name[50];
	
	strcpy(lib_name, OBJECT_LIB_PATH);
	strcat(lib_name, argv[1]);
	strcat(lib_name, ".so");
	
	redirectStdoutToMkfifo();
	
	/* Load dynamic library */
	opaque_handle = loadDynamicLibrary(lib_name);
	
	initTaskHandler(opaque_handle, argv[2]);
	listenTasks();
	
	return EXIT_SUCCESS;
}
